
//

#import "UIBarButtonItem+extension.h"
#import "ZWNavigationController.h"

@interface ZWNavigationController ()

@end

@implementation ZWNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    // 自定义tabbar
}

//拦截push进来的控制器
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.childViewControllers.count > 0) {
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem barButtonWithTitle:@"返回" image:@"navigationbar_back_withtext" style:UIBarButtonItemStylePlain target:self action:@selector(back)];
                                                           
        viewController.hidesBottomBarWhenPushed = YES;
    }
    //如果在控制器有设置，就可以让后面设置的按钮可以覆盖它
    [super pushViewController:viewController animated:animated];
}
- (void)back {
    NSLog(@"点击了左边的返回按钮");
    [self popViewControllerAnimated:true];
}
@end
